# while语句示例
i = 1
while i <= 5:
    print(f"第{i}次循环")
    i += 1

# break跳出循环
i = 1
while i <= 10:
    if i == 5:
        break
    print(f"第{i}次循环")
    i += 1

# continue跳过当前循环
i = 1
while i <= 10:
    if i == 5:
        i += 1
        continue
    print(f"第{i}次循环")
    i += 1


# else子句
i = 1
while i <= 5:
    print(f"第{i}次循环")
    i += 1
else:
    print("循环正常结束")

print("=" * 50)
# while循环打印出1到10的记数
i = 1
while i <= 10:
    print(i)
    i += 1

print("=" * 50)
# while循环进行猜数字游戏
import random
number = random.randint(1, 100)
i = 3
while True:
    if i == 0:
        print("您已没有机会了")
        break
    number_input = int(input("请输入数字："))
    if number_input > number:
        print("数字太大")
        i -= 1
        if i != 0:
            print(f"您还有{i}次机会")
    elif number_input < number:
        print("数字太小")
        i -= 1
        if i != 0:
            print(f"您还有{i}次机会")
    else:
        print("恭喜你猜对了")
        break

print("=" * 50)
while True:
    print("1. 查看余额")
    print("2. 存钱")
    print("3. 取钱")
    print("4. 退出")
    choice = int(input("请选择："))
    if choice == 4:
        break
    elif choice == 1:
        print("余额为：100000000")
    elif choice == 2:
        print("存钱")
    elif choice == 3:
        print("取钱")
    else:
        print("输入错误")
